#!/usr/bin/env python

import sys,os

def build( bld ):
    fastBenchs = [ "adaptivearcod", "jpeg", "engine", "g3fax", "adaptiveardecod"
                 , "AES", "arcoder", "ardecoder", "bcnt", "blit",  "bwt1", "comp-2"
                 , "expand-2",  "coder1",  "coder",  "crc",  "des",  "dhry"
                 , "fact", "fib",  "fir2", "fft", "gamma", "hanoi", "huff",  "queens"
                 , "lms",  "lzencode", "lzdecode",  "lzw",  "lzw1",  "matrix"
                 , "mib_auto_bitcount",  "mib_auto_qsort","quicksort", "rle1", "rle2"
                 , "rle3", "rle4", "mib_off_strsearch","pocsag", "v42", "wavelt"
                 , "mib_sec_sha", "des", "bcnt", "deepCalls"]

    files = os.listdir('simple_benchmarks')
    files = filter( lambda x: x.endswith('.c') and os.path.splitext(os.path.basename(x))[0] in fastBenchs, files )

    for f in files:
        obj = None
        for arch in bld.lst_variants:
            if arch == 'default': continue
            if not obj:
                obj = bld.new_task_gen('cc','program')
                obj.env      = bld.env_of_name(arch).copy()
                obj.source = f
                obj.env.append_unique('LINKFLAGS', '-lm')
                obj.target = os.path.splitext(f)[0]
            else:
                obj.clone(arch)
